package com.ruoyi.broker.mapper;

import com.ruoyi.broker.domain.BrokerApply;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 经纪人审核Mapper接口
 * 
 * @author ruoyi
 * @date 2025-04-09
 */
public interface BrokerApplyMapper 
{
    /**
     * 查询经纪人审核
     * 
     * @param id 经纪人审核主键
     * @return 经纪人审核
     */
    public BrokerApply selectBrokerApplyById(Long id);

    /**
     * 查询经纪人审核列表
     * 
     * @param brokerApply 经纪人审核
     * @return 经纪人审核集合
     */
    public List<BrokerApply> selectBrokerApplyList(BrokerApply brokerApply);

    /**
     * 新增经纪人审核
     * 
     * @param brokerApply 经纪人审核
     * @return 结果
     */
    public int insertBrokerApply(BrokerApply brokerApply);

    /**
     * 修改经纪人审核
     * 
     * @param brokerApply 经纪人审核
     * @return 结果
     */
    public int updateBrokerApply(BrokerApply brokerApply);

    /**
     * 删除经纪人审核
     * 
     * @param id 经纪人审核主键
     * @return 结果
     */
    public int deleteBrokerApplyById(Long id);

    /**
     * 批量删除经纪人审核
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteBrokerApplyByIds(Long[] ids);


    @Select("select technician_invitation_code from t_technician where technician_tel = #{partnerTel}")
    String selectPartnerTechnicianByTel(@Param("partnerTel") String partnerTel);

    @Update("update t_technician set technician_identity = #{userIdentity}, technician_invited_code = #{userInvitationCode} where id = #{tid}")
    Integer updateTechnicianIdentity(@Param("tid") Long tid,@Param("userIdentity") Integer userIdentity,@Param("userInvitationCode") String userInvitationCode);
    @Select("select technician_invitation_code from t_technician where id = #{tid}")
    String selectTechnicianInvitetionCode(@Param("tid")Long tid);
}
